﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace 综合同步
{
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public class SYSTEMTIME
    {
        public ushort wYear;
        public ushort wMonth;
        public ushort wDayOfWeek;
        public ushort wDay;
        public ushort wHour;
        public ushort wMinute;
        public ushort wSecond;
        public ushort wMilliseconds;

        public DateTime ToDateTime()
        {
            return new DateTime(this.wYear, this.wMonth, this.wDay,
                this.wHour, this.wMinute, this.wSecond, this.wMilliseconds);
        }
        public static SYSTEMTIME FromDateTime(DateTime time)
        {
            return new SYSTEMTIME() {
                wYear=(ushort)time.Year,
                wMonth= (ushort)time.Month,
                wDayOfWeek= (ushort)time.DayOfWeek,
                wDay= (ushort)time.Day,
                wHour= (ushort)time.Hour,
                wMinute = (ushort)time.Minute,
                wSecond = (ushort)time.Second,
                wMilliseconds= (ushort)time.Millisecond
            };
        }
    }

    public struct TcmsData
    {
        public float m_fTrainSpeed;//速度
        public int m_iCurrentStationSN;//当前站
        public int m_iNextStationSN;//下一站

        public float m_dVoltage;//电压
        public float m_dElecitric;//电流
        public int m_uCCUIndex;//ccu
        public int m_iData;//开关信息

        public DateTime m_tTime;
        public DateTime getTime(){return m_tTime;}
    }
}
